
<%--
  Created by IntelliJ IDEA.
  User: 32312
  Date: 2024/1/9
  Time: 11:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>

<!doctype html>
<html  lang="en">

<head>
    <!-- meta data -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->

    <!--font-family-->
    <link href="https://fonts.googleapis.com/css?family=Poppins:100,200,300,400,500,600,700,800,900&amp;subset=devanagari,latin-ext" rel="stylesheet">

    <!-- title of site -->
    <title>Sign up</title>

    <!-- For favicon png -->
    <link rel="shortcut icon" type="image/icon" href="/resource/logo/favicon.png"/>

    <!--font-awesome.min.css-->
    <link rel="stylesheet" href="/resource/css/font-awesome.min.css">

    <!--animate.css-->
    <link rel="stylesheet" href="/resource/css/animate.css">

    <!--bootstrap.min.css-->
    <link rel="stylesheet" href="/resource/css/bootstrap.min.css">

    <!-- bootsnav -->
    <link rel="stylesheet" href="/resource/css/bootsnav.css" >

    <!--style.css-->
    <link rel="stylesheet" href="/resource/css/style.css">

    <!--responsive.css-->
    <link rel="stylesheet" href="/resource/css/responsive.css">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <script src="/resource/js/jquery-1.7.1.js"></script>
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>
<%--<!--[if lte IE 9]>--%>
<%--<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="https://browsehappy.com/">upgrade your browser</a> to improve your experience and security.</p>--%>
<%--<![endif]-->--%>

<%--<!-- signin end -->--%>
<section class="signin signup">
    <div class="container">
        <div class="sign-content">
            <h2>注册</h2>

            <div class="row">
                <div class="col-sm-12">
                    <div class="signin-form">
                        <form  method="post">
                            <div class="form-col">
                                <div class="form-group">
                                    <label for="username">真实姓名</label>
                                    <input type="text" class="form-control" id="username" placeholder="username">
                                </div><!--/.form-group -->
                            </div><!--/.form-col -->
                            <div class="form-col1">
                                <div class="form-group">
                                    <label for="phone">电话号码</label>
                                    <input type="text" class="form-control" id="phone" placeholder="phone" onblur=" p()">
                                </div><!--/.form-group -->
                            </div><!--/.form-col1 -->
                            <div class="form-group">
                                <label for="idcard">身份证号</label>
                                <input type="text" class="form-control" id="idcard" placeholder="enter your ID_card here"onblur=" i()">
                            </div><!--/.form-group -->
                            <div class="form-group">
                                <label for="password">密码</label>
                                <input type="password" class="form-control" id="password" placeholder="Password">
                            </div><!--/.form-group -->
                            <div class="form-group">
                                <label for="confirm">再次输入密码</label>
                                <input type="password" class="form-control" id="confirm" placeholder="Retype Password" onblur="c()">
                            </div><!--/.form-group -->
                        </form><!--/form -->
                    </div><!--/.signin-form -->
                </div><!--/.col -->
            </div><!--/.row -->

<%--            <div class="row">--%>
<%--                <div class="col-sm-12">--%>
<%--                    <div class="signin-password">--%>
<%--                        <div class="awesome-checkbox-list">--%>
<%--                            <ul class="unstyled centered">--%>

<%--                                <li>--%>
<%--                                    <input class="styled-checkbox" id="styled-checkbox-2" type="checkbox" value="value2">--%>
<%--                                    <label for="styled-checkbox-2">accept our terms & condition</label>--%>
<%--                                </li>--%>

<%--                                <li></li>--%>

<%--                            </ul>--%>
<%--                        </div><!--/.awesome-checkbox-list -->--%>
<%--                    </div><!--/.signin-password -->--%>
<%--                </div><!--/.col -->--%>
<%--            </div><!--/.row -->--%>

            <div class="row">
                <div class="col-sm-12">
                    <div class="signin-footer">
                        <button type="button"  class="btn signin_btn" data-toggle="modal" data-target=".signin_modal" id="button">
                            注册
                        </button>
                        <p>
                            already member ?
                            <a href="login.jsp">登录</a>
                        </p>
                    </div><!--/.signin-footer -->
                </div><!--/.col-->
            </div><!--/.row -->

        </div><!--/.sign-content -->

    </div><!--/.container -->

</section><!--/.signin -->


<script>

    $("#button").click(function () {

        if($("#username").val()==""||$("#password").val()==""||$("#confirm").val()==""||$("#idcard").val()==""||
            $("#phone").val()==""){
            alert("信息不能为空，请重新输入");
        }else{
            $.ajax({
                    url:"/adduser",
                    data:{
                        username:$("#username").val(),
                        password:$("#password").val(),
                        idcard:$("#idcard").val(),
                        phone:$("#phone").val()
                    },
                    type:"post",
                    success:function (data) {
                        if(data==""){
                            alert("给身份证号或电话已经绑定账号，一个身份证号与电话号码只允许绑定一个账号")
                        }else{
                            alert("你的账号为："+data)
                            location.href="/jsp/login.jsp";
                        }
                    }
                }
                )
        }
    })

</script>
<script >
    var phoneNumReg = /^1[3|4|5|7|8]\d{9}$/
    function p() {
        if(!phoneNumReg.test(document.getElementById("phone").value)&&(document.getElementById("phone").value)!="") {
            alert('手机号码有误，请重填');
            document.getElementById("phone").value="";
        }
    }

    var idCardRegex = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
    function i() {
        if(!idCardRegex.test(document.getElementById("idcard").value)&&(document.getElementById("idcard").value)!="") {
            alert('身份证号有误，请重新输入');
            document.getElementById("idcard").value="";
        }
    }

    function c() {
        var password = $("#password").val();
        var confirm = $("#confirm").val();
        // var password = document.getElementById("password").value;
        // var confirm = document.getElementById("confirm").value;
        console.log(password);
        console.log(confirm);
        if(password!=confirm && confirm !=""){
            alert("前后密码不一致，请重新输入");
            document.getElementById("confirm").value="";
        }
    }

</script>

<!-- signin end -->

<!--footer copyright start -->
<%-- <footer class="footer-copyright">--%>
<%--     <div id="scroll-Top">--%>
<%--         <i class="fa fa-angle-double-up return-to-top" id="scroll-top" data-toggle="tooltip" data-placement="top" title="" data-original-title="Back to Top" aria-hidden="true"></i>--%>
<%--     </div><!--/.scroll-Top-->--%>

<%-- </footer><!--/.hm-footer-copyright-->--%>
<!--footer copyright  end -->


<!-- Include all js compiled plugins (below), or include individual files as needed -->


<script src="/resource/js/jquery.js"></script>
<!--modernizr.min.js-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script>

<!--bootstrap.min.js-->
<script src="/resource/js/bootstrap.min.js"></script>

<!-- bootsnav js -->
<script src="/resource/js/bootsnav.js"></script>

<!-- jquery.sticky.js -->
<script src="/resource/js/jquery.sticky.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.min.js"></script>


<!--Custom JS-->
<%--<script src="/resource/js/custom.js"></script>--%>

</body>

</html>
